import abc
import struct


class BaseReader(metaclass=abc.ABCMeta):

    @staticmethod
    def unpack_records(fmt, data):
        """

        :param fmt:
        :param data:
        :return:
        """
        record_struct = struct.Struct(fmt)
        return (record_struct.unpack_from(data, offset) for offset in range(0, len(data), record_struct.size))

    @abc.abstractmethod
    def get_df(self, code_or_file, exchange=None):
        """

        :param code_or_file:
        :param exchange:
        """
        raise NotImplementedError('not yet')
